//  秒杀活动页面的渲染
function GetData(){
}
$.extend(GetData.prototype,{
    init:function(){
        this.start();
    },
    start : function(){
        var url = "../scripts/json/data.json"
        $.ajax(url,{
            dataType:"json"
        }).then(function(res){
            new Seckill(res)
        })
    }
})

function Seckill(res){
    this.list = res.seckilldata;
    this.init();
}
$.extend(Seckill.prototype,{
    init:function(){
        this.rebder();
    },
    rebder : function(){
        var html = "";
        for(var i = 0 , item ; item = this.list[i];i++){
            html += `
                    <div class="box_goods" dataid="${item.dataid}">
                    <a href="../html/goods.html#${item.dataid}" class="goods_img">
                        <img src="${item.pathimg}">
                    </a>
                    <div class="goods_price">
                        <a href="../html/goods.html#${item.dataid}" class="price_title">
                            ${item.title}
                        </a>
                        <div class="price_box ${item.price_box_style}">
                            <div class="price_left">
                                <p>
                                    <span class="price ${item.price_style}">
                                        <a href="#">
                                                <span>￥</span>
                                                ${item.price}
                                        </a>
                                    </span>
                                    <span class="old_price">
                                        <span>￥</span>
                                        ${item.oldprice}
                                    </span>
                                </p>
                            </div>
                            <div class="price_right ${item.price_right_style}">
                                <a href="../html/goods.html#${item.dataid}">${item.state}</a>
                            </div>
                        </div>
                    </div>
                </div>
            `
        }
        $(".right_box").html(html)
    }
})
let getData = new GetData();
export  {getData};